package com.guoning.office_system.service.impl;

import com.guoning.office_system.mapper.SignInMapper;
import com.guoning.office_system.model.SignIn;
import com.guoning.office_system.model.SignInWithBLOBs;
import com.guoning.office_system.service.SignInService;
import com.guoning.office_system.utils.DateFormatUtils;
import com.guoning.office_system.vo.Criteria;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class SignInServiceImpl implements SignInService {
    @Autowired
    SignInMapper signInMapper;

    @Override
    public List<SignInWithBLOBs> selectRecordByUser(Criteria criteria) {
        return signInMapper.selectRecordByUser(criteria);
    }

    @Override
    public int deleteByPrimaryKey(Long id) {
        return 0;
    }

    @Override
    public int insert(SignInWithBLOBs record) {
        Date now = new Date();
        String signCode = DateFormatUtils.format(now, DateFormatUtils.DATE_MODEL_8 + record.getUserId());
        record.setSignCode(signCode);
        record.setCreateTime(now);
        return signInMapper.insert(record);
    }

    @Override
    public int insertSelective(SignInWithBLOBs record) {
        return 0;
    }

    @Override
    public SignInWithBLOBs selectByPrimaryKey(Long id) {
        return null;
    }

    @Override
    public int updateByPrimaryKeySelective(SignInWithBLOBs record) {
        return 0;
    }

    @Override
    public int updateByPrimaryKeyWithBLOBs(SignInWithBLOBs record) {
        return 0;
    }

    @Override
    public int updateByPrimaryKey(SignIn record) {
        return 0;
    }
}